import 'package:wch/generated/json/base/json_convert_content.dart';
import 'package:wch/model/patient_label_list.dart';

PatientLabelListModel $PatientLabelListModelFromJson(
    Map<String, dynamic> json) {
  final PatientLabelListModel patientLabelListModel = PatientLabelListModel();
  final List<
      PatientLabelListShopLabelList>? shopLabelList = (json['shopLabelList'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<PatientLabelListShopLabelList>(
          e) as PatientLabelListShopLabelList).toList();
  if (shopLabelList != null) {
    patientLabelListModel.shopLabelList = shopLabelList;
  }
  return patientLabelListModel;
}

Map<String, dynamic> $PatientLabelListModelToJson(
    PatientLabelListModel entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['shopLabelList'] = entity.shopLabelList?.map((v) => v.toJson()).toList();
  return data;
}

extension PatientLabelListModelExtension on PatientLabelListModel {
  PatientLabelListModel copyWith({
    List<PatientLabelListShopLabelList>? shopLabelList,
  }) {
    return PatientLabelListModel()
      ..shopLabelList = shopLabelList ?? this.shopLabelList;
  }
}

PatientLabelListShopLabelList $PatientLabelListShopLabelListFromJson(
    Map<String, dynamic> json) {
  final PatientLabelListShopLabelList patientLabelListShopLabelList = PatientLabelListShopLabelList();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    patientLabelListShopLabelList.id = id;
  }
  final String? hospitalId = jsonConvert.convert<String>(json['hospitalId']);
  if (hospitalId != null) {
    patientLabelListShopLabelList.hospitalId = hospitalId;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    patientLabelListShopLabelList.name = name;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    patientLabelListShopLabelList.type = type;
  }
  final String? colour = jsonConvert.convert<String>(json['colour']);
  if (colour != null) {
    patientLabelListShopLabelList.colour = colour;
  }
  final String? text = jsonConvert.convert<String>(json['text']);
  if (text != null) {
    patientLabelListShopLabelList.text = text;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    patientLabelListShopLabelList.status = status;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    patientLabelListShopLabelList.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    patientLabelListShopLabelList.updateTime = updateTime;
  }
  return patientLabelListShopLabelList;
}

Map<String, dynamic> $PatientLabelListShopLabelListToJson(
    PatientLabelListShopLabelList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['hospitalId'] = entity.hospitalId;
  data['name'] = entity.name;
  data['type'] = entity.type;
  data['colour'] = entity.colour;
  data['text'] = entity.text;
  data['status'] = entity.status;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  return data;
}

extension PatientLabelListShopLabelListExtension on PatientLabelListShopLabelList {
  PatientLabelListShopLabelList copyWith({
    String? id,
    String? hospitalId,
    String? name,
    int? type,
    String? colour,
    String? text,
    String? status,
    String? createTime,
    String? updateTime,
  }) {
    return PatientLabelListShopLabelList()
      ..id = id ?? this.id
      ..hospitalId = hospitalId ?? this.hospitalId
      ..name = name ?? this.name
      ..type = type ?? this.type
      ..colour = colour ?? this.colour
      ..text = text ?? this.text
      ..status = status ?? this.status
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime;
  }
}